home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000680_rafael@icp.grenet.fr_Thu Jun 23 15:50:52 1994.msg < prev    next >
Internet Message Format  |  1994-10-11  |  6KB

  1. Received: from cicg-communication.grenet.fr by cs.umb.edu with SMTP id AA08575
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Thu, 23 Jun 1994 07:48:58 -0400
  3. Message-Id: <199406231148.AA08575@cs.umb.edu>
  4. Received: from icp.grenet.fr (cristal.icp.grenet.fr) by cicg-communication.grenet.fr (4.1/Ccomm.94021501)
  5.           id AA02977; Thu, 23 Jun 94 13:48:07 +0200
  6. Icp-Warning: ***************************************************
  7.              *  PLEASE NOTE THAT ICP HAS CHANGED ITS INTERNET  *
  8.              *  DOMAIN FROM imag.fr TO icp.grenet.fr.  ALL     *
  9.              *  MESSAGES SHOULD BE SENT TO user@icp.grenet.fr  *
  10.              ***************************************************
  11. Date: Thu, 23 Jun 94 13:50:52 +0200
  12. From: rafael@icp.grenet.fr (Rafael Laboissiere)
  13. Posted-Date: Thu, 23 Jun 94 13:50:52 +0200
  14. To: tex-k@cs.umb.edu
  15. Subject: Making xdvik understand better \epsfig
  16. Cc: rafael@icp.grenet.fr
  17.  
  18.  
  19. Dear developer(s) of xdvik,
  20.  
  21. Some days ago I ran into a problem concerning the preview of
  22. an Encapsulated PostScript figure by xdvik.  My latex code were:
  23.  
  24. \epsfig{file=jaw.eps,height=10cm}
  25.  
  26. This generates the following \special commands (in my .dvi file):
  27.  
  28. PSfile="jaw.eps" llx=0 lly=0 urx=464.73624 ury=915.42 rhi=2834 
  29.  
  30. The problem is that the C code of epsf.c in the xdvik distribution is
  31. hard-coded to understand only \special lines containing "rwi" instead of
  32. "rhi".  Had I used the "width" option instead of "height" and my
  33. problem would be gone. 
  34.  
  35. I successfully modified the file epsf.c to do the job correctly and I
  36. am including the patch below.  The version I am using is "xdvik
  37. version 1.8" (obtained with the command xdvi -version).
  38.  
  39. Please, send any commentary directly to me;  I am not subscribed to
  40. this mailing-list.
  41.  
  42. I hope this will be useful,
  43.  
  44. Rafael LABOISSIERE                           |   
  45. Institut de la Communication Parlee - INPG   |  Tel: +33-76.57.48.49     
  46. 46, av. Felix Viallet                 |  Fax: +33-76.57.47.10     
  47. F-38031 Grenoble CEDEX France             |  Email: rafael@icp.grenet.fr
  48.  
  49. ----------------------cut here-------------------------------------
  50. *** epsf.c    Wed Jun 22 03:11:21 1994
  51. --- epsf.c.original    Wed Jun 22 02:53:45 1994
  52. ***************
  53. *** 100,110 ****
  54.    * if you'd like.
  55.    */
  56.   static Boolean
  57. ! parse_special(orig_special, psfilename, llx, lly, urx, ury, rwi, rhi)
  58.     char *orig_special, *psfilename;
  59. !   int *llx, *lly, *urx, *ury, *rwi, *rhi;
  60.   {
  61. !   float llx_f, lly_f, urx_f, ury_f, rwi_f, rhi_f;
  62.     char *special = orig_special;
  63.     
  64.     special += 7; /* skip the ``psfile='' which may be case-mixed */
  65. --- 100,110 ----
  66.    * if you'd like.
  67.    */
  68.   static Boolean
  69. ! parse_special(orig_special, psfilename, llx, lly, urx, ury, rwi)
  70.     char *orig_special, *psfilename;
  71. !   int *llx, *lly, *urx, *ury, *rwi;
  72.   {
  73. !   float llx_f, lly_f, urx_f, ury_f, rwi_f;
  74.     char *special = orig_special;
  75.     
  76.     special += 7; /* skip the ``psfile='' which may be case-mixed */
  77. ***************
  78. *** 119,139 ****
  79.             *urx = urx_f + .5;
  80.             *ury = ury_f + .5;
  81.             *rwi = rwi_f + .5;
  82. -       *rhi = -1;
  83.             return True;
  84.           }
  85. -      else
  86. -        if (sscanf(special, "llx=%f lly=%f urx=%f ury=%f rhi=%f",
  87. -                   &llx_f, &lly_f, &urx_f, &ury_f, &rhi_f) == 5)
  88. -      {
  89. -        *llx = llx_f + .5;
  90. -        *lly = lly_f + .5;
  91. -        *urx = urx_f + .5;
  92. -        *ury = ury_f + .5;
  93. -        *rhi = rhi_f + .5;
  94. -        *rwi = -1;
  95. -        return True;
  96. -      }
  97.       }
  98.   
  99.     Moan("\"%s\" not understood.", orig_special);
  100. --- 119,126 ----
  101. ***************
  102. *** 144,152 ****
  103.    * Simple sscanf version of finding psfig \special parameters.
  104.    */
  105.   static Boolean
  106. ! parse_psfig_special(special, width, height, llx, lly, urx, ury, rwi, rhi)
  107.     char *special;
  108. !   int *width, *height, *llx, *lly, *urx, *ury, *rwi, *rhi;
  109.   {
  110.     if (sscanf(special, "ps::[begin] %d %d %d %d %d %d",
  111.                 width, height, llx, lly, urx, ury) == 6) {
  112. --- 131,139 ----
  113.    * Simple sscanf version of finding psfig \special parameters.
  114.    */
  115.   static Boolean
  116. ! parse_psfig_special(special, width, height, llx, lly, urx, ury, rwi)
  117.     char *special;
  118. !   int *width, *height, *llx, *lly, *urx, *ury, *rwi;
  119.   {
  120.     if (sscanf(special, "ps::[begin] %d %d %d %d %d %d",
  121.                 width, height, llx, lly, urx, ury) == 6) {
  122. ***************
  123. *** 513,535 ****
  124.   epsfile(special)
  125.     char *special;
  126.   {
  127. !   int llx, lly, urx, ury, rwi, rhi;
  128.     char psfilename[100];
  129.     float epsf_scale;
  130.     struct bitmap *bitmap;
  131.   
  132.     if (no_epsf) return;
  133. !   if (!parse_special(special, psfilename, &llx, &lly, &urx, &ury, &rwi, &rhi)) 
  134.       return;
  135.   
  136.     /* rwi is 10 times the desired width, in points (but scaled by the
  137.        magnification).  epsf_scale is thus the scale according to the
  138.        \special command.  (For epsfile.tex specials, x and y scale are
  139.        always the same.) */
  140. !   if (rhi == -1)
  141. !     epsf_scale = (rwi * (magnification / 10000.0)) / (urx - llx + 1);
  142. !   else
  143. !     epsf_scale = (rhi * (magnification / 10000.0)) / (ury - lly + 1);
  144.   
  145.     /* 
  146.      * Scale the bounding box.  The floating point calculations have
  147. --- 500,519 ----
  148.   epsfile(special)
  149.     char *special;
  150.   {
  151. !   int llx, lly, urx, ury, rwi;
  152.     char psfilename[100];
  153.     float epsf_scale;
  154.     struct bitmap *bitmap;
  155.   
  156.     if (no_epsf) return;
  157. !   if (!parse_special(special, psfilename, &llx, &lly, &urx, &ury, &rwi)) 
  158.       return;
  159.   
  160.     /* rwi is 10 times the desired width, in points (but scaled by the
  161.        magnification).  epsf_scale is thus the scale according to the
  162.        \special command.  (For epsfile.tex specials, x and y scale are
  163.        always the same.) */
  164. !   epsf_scale = (rwi * (magnification / 10000.0)) / (urx - llx + 1);
  165.   
  166.     /* 
  167.      * Scale the bounding box.  The floating point calculations have